#ifndef __WS_H
#define __WS_H
#include "Com_Debug.h"
#include "esp_websocket_client.h"
#include "ota.h"
#include "esp_crt_bundle.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "cJSON.h"
#include "iot.h"

typedef struct
{
    bool is_connected;

    EventGroupHandle_t eg;

    void (*text_cb)(char *, int);
    void (*bin_cb)(char *, int);
    void (*close_cb)(void);
} my_ws_t;
extern my_ws_t my_ws;

void ws_init(void (*text_cb)(char *, int),
             void (*bin_cb)(char *, int),
             void (*close_cb)(void));
void ws_open_audio_channel(void);

void ws_send_hello(void);

void ws_send_abort(void);

void ws_send_wake(void);

void ws_send_start_listening(void);

void ws_send_stop_listening(void);

void ws_send_iot_descriptor(void);

void ws_send_iot_state(void);

void ws_send_bin(char *bin, int len);

#endif
